package com.user.manage.util;

public class ValidateUtil {

    static String emailReg = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";

    static String mobileReg = "^1[34578]\\d{9}$";

    // 验证邮箱
    public static boolean isEmail(String email) {

        // 邮箱格式

        if (email.matches(emailReg)) {
            return true;
        }

        return false;
    }

    public static boolean isMobile(String mobile) {
        if (mobile.matches(mobileReg)) {
            return true;
        }
        return false;
    }


    //验证长度
    public static boolean isLength(String str, int min, int max) {
        if (str.length() >= min && str.length() <= max) {
            return true;
        }
        return false;
    }

    public static boolean minLength(String str, int min) {
        if (str.length() >= min) {
            return true;
        }
        return false;
    }
}
